<?php
defined( '_VALID_MOS' ) or die( 'Restricted access' );
class HTML_video {
	//show Gallery
	function showVideo( &$rows ){
		global $mosConfig_live_site;
		$url = $mosConfig_live_site."/administrator/components/com_video/uploads/";
		?>
		<div id="title-cat"><div>Video Clip</div></div>
    	<div id="content-cat">
			<div id="tab_content">
				<ul>
					<?php
					for ($i=0; $i<count($rows); $i++){
					$link = sefRelToAbs("index.php?option=com_video&task=view&id=".$rows[$i]->id);
					if ($i%20==0 && $i>0){
						echo '</ul>';
						echo '<ul>';
					}
					if (($i+1)%4==0 && $i>0){
						$style = ' style="margin-right:0;"';
					}else{
						$style = '';
					}
					?>
					<li class="li_gallery">
						<div class="gallery_box"<?php echo $style;?>><a href="<?php echo $link;?>"><img src="<?php echo $url.$rows[$i]->img;?>" border="0" /></a></div>
					</li>
					<?php
					}
					?>
				</ul>
			</div>
			<?php if (count($rows)>20){?>
			<div class="clear"></div>
			<div id="tab_content_page">
				<a href="#" id="btn_tab_prev">Prev</a>
				<a href="#" id="btn_tab_next">Next</a>
			</div>
			<?php }?>	
		</div>
		<?php
	}
	
	//play Video
	function playVideo( &$row, &$rows ){
		global $mosConfig_live_site;
		$dirVideo = $mosConfig_live_site."/administrator/components/com_video/uploads";
		?>
		<div id="title-cat"><div>Video Clip : <?php echo $row->name;?></div></div>
    	<div id="content-cat">
    	<table>
	    	<tr>
	    		<td valign="top">
	    			<div id="show_video_default">
						<div class="show_video" style="width: 350px; height: 300px;">
							<embed width="350" height="300" allowfullscreen="true" flashvars="displayheight=300&amp;width=350&amp;height=450&amp;showdownload=true&amp;autostart=false&amp;repeat=false&amp;volume=100&amp;file=<?php echo $dirVideo;?>/<?php echo $row->namefile;?>&amp;image=<?php echo $dirVideo;?>/<?php echo $row->img;?>" type="application/x-shockwave-flash" src="<?php echo $mosConfig_live_site;?>/images/mediaplayer.swf">
						</div>
					</div>
					<?php
					for ($i=0; $i<count($rows); $i++){
						?>
						<div id="show_video_<?php echo $rows[$i]->id;?>" class="ls_show_video">
							<div class="show_video" style="width: 350px; height: 300px;">
								<embed width="350" height="300" allowfullscreen="true" flashvars="displayheight=300&amp;width=350&amp;height=450&amp;showdownload=true&amp;autostart=false&amp;repeat=false&amp;volume=100&amp;file=<?php echo $dirVideo;?>/<?php echo $rows[$i]->namefile;?>&amp;image=<?php echo $dirVideo;?>/<?php echo $rows[$i]->img;?>" type="application/x-shockwave-flash" src="<?php echo $mosConfig_live_site;?>/images/mediaplayer.swf">
							</div>
						</div>
						<?php
					}
					?>
	    		</td>
	    		<td valign="top">
					<div id="tab_content">
						<ul>
						<?php	
						for ($i=0; $i<count($rows); $i++){
							if ($i%3==0 && $i>0){
								echo '</ul>';
								echo '<ul>';
							}
							?>
							<li style="list-style: none;">
							<div class="video_box" id="video_<?php echo $rows[$i]->id;?>" style="width: 300px;">
								<a id="video_<?php echo $rows[$i]->id;?>"><img src="<?php echo $dirVideo;?>/<?php echo $rows[$i]->img;?>" border="0" /></a>
								<p><a id="video_<?php echo $rows[$i]->id;?>"><?php echo $rows[$i]->name;?></a></p>
								<p class="date"><?php echo unFormatDate($rows[$i]->created, "d.m.Y");?></p>
							</div>
							</li>
							<?php
						}
						?>
						</ul>
					</div>
					<?php if (count($rows)>3){?>
					<div class="clear"></div>
					<div id="tab_content_page" style="padding-left: 20px;">
						<a href="#" id="btn_tab_prev">Prev</a>
						<a href="#" id="btn_tab_next">Next</a>
					</div>
					<?php }?>		
	    		</td>
	    	</tr>
    	</table>
		<script type="text/javascript">
		$(function() {
			<?php for ($i=0; $i<count($rows); $i++){ ?>
			$('#show_video_default').show();
			$('.ls_show_video').hide();
			$('#video_<?php echo $rows[$i]->id;?>, #video_div_<?php echo $rows[$i]->id;?>').click(function() {
				$('#show_video_default').hide();
				$('.ls_show_video').hide();
				$('#show_video_<?php echo $rows[$i]->id;?>').show();
			});
		    <?php }?>
		});
		</script>
		</div>	
		<?php
	}
}
?>